/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup;

/**
 * @author: huym
 * @version: 1.0
 * @date: 2020/12/9
 */
public class Main {
    public static void main(String[] args) {
        //int[] arr = {1,3,2,6,4,8,5,0};
        //Cat[] arr = {new Cat(3,3), new Cat(5,5), new Cat(1,1)};
        Dog[] arr = {new Dog(3), new Dog(5), new Dog(1)};
        Sorter<Dog> sorter1 = new Sorter<>();
        sorter1.sort(arr, new DogComparator());
        for (int i=0;i<arr.length;i++){
            System.out.print(arr[i]+"  ");
        }
        System.out.println("==========================");
        Cat[] arr2 = {new Cat(3,3), new Cat(5,5), new Cat(1,1)};
        Sorter<Cat> sorter2 = new Sorter<>();
        sorter2.sort(arr2, new CatWeightComparator());
        for (int i=0;i<arr2.length;i++) {
            System.out.print(arr2[i]+"  ");
        }
        System.out.println("==========================");
        sorter2.sort(arr2, new CatHeightComparator());
        for (int i=0;i<arr2.length;i++) {
            System.out.print(arr2[i]+"  ");
        }
        System.out.println("==========================");
        sorter2.sort(arr2, (o1,o2)->{
            if (o1.weight>o2.weight) return 1;
            else if (o1.weight<o2.weight) return -1;
            else return 0;
        });
        for (int i=0;i<arr2.length;i++) {
            System.out.print(arr2[i]+"  ");
        }

    }
}